#include<stdio.h>
int main()
{
    char a[10];double h[10]={0},result;
    int i=0,n;
    scanf("%d",&n);
    getchar();
    for(i=0;i<n;i++)
    {
        scanf("%c %lf",&a[i],&h[i]);
        getchar();
    }
    for(i=0;i<n;i++)
    {
    	if(a[i]=='M')
            result = h[i]/1.09;
        else if(a[i]=='F')
            result = 1.09*h[i];
        printf("%.2lf\n",result);
	}
    
}